import random


class BigOrSmall():
    def Bigger(self):
        print("你猜大了")

    def Small(self):
        print("你猜小了")

    def Same(self):
        print("恭喜您猜对了")


x = random.randint(0, 100)
num = BigOrSmall()
n = 0
while True:
    y = int(input("请输入一个数字猜大小："))
    n += 1
    if y > x:
        num.Bigger()
        continue
    elif y < x:
        num.Small()
        continue
    else:
        num.Same()
        break
print("总共用了%d次猜出结果" % n)
